<?php

/**
 * @Author: Wang Chunsheng 2192138785@qq.com
 * @Date:   2020-03-11 16:42:29
 * @Last Modified by:   Wang Chunsheng 2192138785@qq.com
 * @Last Modified time: 2020-03-25 03:43:26
 */

use common\models\DdRegion;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\Url;

/* @var $this yii\web\View */
/* @var $model app\modules\diandi_shop\models\DdShopAreas */
/* @var $form yii\widgets\MyActiveForm */
?>
<style>
    .modal-body {
    position: relative;
    padding: 15px;
    height: auto;
    overflow: auto;
}
</style>
<div class="dd-shop-areas-form">

    <?php $form = ActiveForm::begin([
        'action' => Url::to(['upaddress'])
    ]); ?>
    <?= Html::activeHiddenInput($address, 'order_id') ?>

    <?= $form->field($address, 'name')->textInput(['maxlength' => true]) ?>

    <?= $form->field($address, 'phone')->textInput(['maxlength' => true]) ?>

    <?= $form->field($address, 'detail')->textInput(['maxlength' => true]) ?>


    <?= $form->field($address, 'province_id')->widget(\diandi\region\Region::className(), [
        'model' => $address,
        'url'=> \yii\helpers\Url::toRoute(['get-region']),
        'province' => [
            'attribute' => 'province_id',
            'items' => DdRegion::getRegion(),
            'options' => ['class' => 'form-control col-xs-4', 'prompt' => '选择省份']
        ],
        'city' => [
            'attribute' => 'city_id',
            'items' => DdRegion::getRegion($address['province_id']),
            'options' => ['class' => 'form-control col-xs-4', 'prompt' => '选择城市']
        ],
        'district' => [
            'attribute' => 'region_id',
            'items' => DdRegion::getRegion($address['city_id']),
            'options' => ['class' => 'form-control col-xs-4', 'prompt' => '选择县/区']
        ]
    ]); ?>

  
    
    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
        <div class="form-group" style="margin-top: 10px;">
                <?= Html::submitButton('保存', ['class' => 'btn btn-success']) ?>
        </div>
    </div>
            

 

    <?php ActiveForm::end(); ?>

</div>